﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

using Ext.Net;
using System.Collections.Generic;

public partial class Popup_Popup_Mat2 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            DateTime dt = DateTime.Now;
            this.dtFrom.Text = dt.Year.ToString() + "-" + "01" + "-" + "01";
            this.dtTo.Text = dt.Year.ToString() + "-" + dt.Month.ToString() + "-" + dt.Day.ToString();
        }
    }

    protected void CreateParameter(object sender, DirectEventArgs e)
    {
        string json = e.ExtraParams["Values"];

        Dictionary<string, string>[] dicValues = JSON.Deserialize<Dictionary<string, string>[]>(json);
        string strVal = string.Empty;

        foreach (Dictionary<string, string> dic in dicValues)
        {
            foreach (KeyValuePair<string, string> row in dic)
            {
                strVal += row.Value + "|";
            }
        }

        strVal = strVal.Remove(strVal.Length - 1);
        hdRowValue.Text = strVal;
    }


    #region 조회
    protected void PopListSearch(object sender, DirectEventArgs e)
    {
        SetGrid();
    }


    protected void SetGrid()
    {
        using (EmdisBest.WebService.Service oService = new EmdisBest.WebService.Service())
        {
            DataSet ds = null;
            string strFrom = this.dtFrom.Text.Substring(0, 10).Replace("-", "/");
            string strTo = this.dtTo.Text.Substring(0, 10).Replace("-", "/");

            ds = oService.Select_D_DAYWRITE_POP2_C_ITEM_S(this.tbxCustomer.Text, this.tbxMatName.Text, strFrom, strTo);
            this.Store1.DataSource = ds.Tables[0];
            this.Store1.DataBind();

            //this.Store1.DataSource = ds;
            //this.Store1.DataBind();
        }
    } 
    #endregion
}
